# Copyright 2017 The Bazel Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#    http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

workspace(name = "e2e_testing")

# Placeholder repository definition to import rules_docker. To be replaced
# with real path on bazel invocation using --override_repository
local_repository(
    name = "io_bazel_rules_docker",
    path = "replace/this/path",
)

load(
    "@io_bazel_rules_docker//toolchains/docker:toolchain.bzl",
    docker_toolchain_configure = "toolchain_configure",
)

# Import the location of the docker client config dynamically injected into
# this workspace by the e2e test driver
load(":def.bzl", "client_config")

docker_toolchain_configure(
    name = "docker_config",
    client_config = client_config,
)

# This is NOT needed when going through the language lang_image
# "repositories" function(s).
load(
    "@io_bazel_rules_docker//repositories:repositories.bzl",
    container_repositories = "repositories",
)

container_repositories()

load(
    "@io_bazel_rules_docker//repositories:go_repositories.bzl",
    container_go_deps = "go_deps",
)

container_go_deps()

load(
    "@io_bazel_rules_docker//container:container.bzl",
    "container_pull",
)

# For testing
container_pull(
    name = "distroless_fixed_id",
    registry = "gcr.io",
    repository = "distroless/base",
)

load(
    "@docker_config//:pull.bzl",
    authenticated_local_pull = "container_pull",
)

authenticated_local_pull(
    name = "local_pull",
    registry = "localhost:5000",
    repository = "docker/test",
    tag = "test",
)
